<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let sm1 = Symbol();
        let sm2 = Symbol();
        console.log(sm1==sm2); // false

        let sm3 = Symbol('s1'); // 添加描述
        let sm4 = Symbol('s2'); // 添加描述
        console.log(sm3.description); // s1
        // 使用Symbol.for定义
        let sm5 = Symbol.for('admin');
        let sm6 = Symbol.for('admin');
        console.log(sm5==sm6); // true
        // Symbol.for 获取描述的方式
        console.log(Symbol.keyFor(sm5)); // admin
    </script>
</body>
</html>